<div class="container-fluid">
  <a class='label label-success pull-right' href='/tag/list/' style='margin-right:5px;'>返回标签列表</a>
  <span class='label label-info'>标签管理</span>
  <div style='border-top:1px solid #ddd;'></div>
  <div style='height:10px;clear:both;'></div>
  <table class='table table-bordered'>
    <thead>
      <tr>
        <th style='width:100px;'>#专题</th>
        <th>#标签</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><?php echo $collection->name;?></td>
        <td>
          <ul style='margin:0px;'>
            <?php foreach ($collection->tags as $t):?>
            <li style='list-style:none;float:left;margin-left:20px;'>
	      <?php echo $t->name;?>
            </li>
            <?php endforeach;?>
          </ul>
        </td>
      </tr>
    </tbody>
  </table>

  <span class='label label-info'>标签组</span>
  <a class='label label-success pull-right' href='/tag/new_group/?collection_id=<?php echo $collection->id;?>'>新建</a>
  <table class='table table-bordered'>
    <thead>
      <tr>
        <th style='width:100px;'>#标签组</th>
        <th>#标签</th>
        <th style='width:60px'>#OP</th>
        <th style='width:60px'>#OP2</th>
        <th style='width:60px'>#OP3</th>
      </tr>
    </thead>
    <tbody>
    <?php foreach ($collection->groups as $g):?>
      <tr>
        <td><?php echo $g->name;?></td>
        <td><?php echo $g->tags;?></td>
        <td><a href='javascript:void(0)' class='btn btn-mini btn-primary tag' data-collection-id='<?php echo $collection->id;?>' data-tags='<?php echo $g->tags;?>' data-group-id='<?php echo $g->id;?>'>加标签</a></td>
        <td><a href='javascript:void(0)' class='btn btn-mini btn-primary edit' data-collection-id='<?php echo $collection->id;?>' data-tags='<?php echo $g->tags;?>' data-group-id='<?php echo $g->id;?>'>编辑</a></td>
        <td><a href='javascript:void(0)' class='btn btn-mini btn-danger delete' data-group-id='<?php echo $g->id;?>'>删除</a></td>
      </tr>
    <?php endforeach;?>
    </tbody>
  </table>
</div>


<div class="modal hide fade" id='tag_modal'>
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>编辑标签</h3>
  </div>
  <div class="modal-body">
    <div class="input-append">
      <input class="span6" id="tags" name='tags' type="text">
      <button class="btn" type="button" id='add_tag_btn'>贴标签</button>
    </div>
    <ul style='margin:0px;' class='tags'>
      <?php foreach ($collection->tags as $t):?>
      <li style='list-style:none;float:left;padding:5px;'><a class='tag' href='javascript:void(0)' data-tag='<?php echo $t->name;?>'><?php echo $t->name;?></a></li>
      <?php endforeach;?>
    </ul>
  </div>
  <div class="modal-footer">
    <a href="javascript:void(0)" class="btn" data-dismiss="modal" aria-hidden="true">Close</a>
  </div>
</div>

